﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:local="clr-namespace:advadev.Windows.Graph">

    <Color x:Key="filterColor">#FFFFFF</Color>
    <SolidColorBrush x:Key="filterColorBrush" Color="{StaticResource filterColor}" />
    <Style TargetType="{x:Type local:GraphSegmentContainer}">
        <Setter Property="KeyboardNavigation.IsTabStop" Value="False" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type local:GraphSegmentContainer}">
                    <Grid Name="grid">
                        <Grid.Effect>
                            <local:ColorFilterEffect FilterColor="{Binding ElementName=graphSegment, Path=FilterColor}" />
                        </Grid.Effect>
                        <local:GraphSegment x:Name="graphSegment" DataContext="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=StartElement.DataContext}" ParentGraph="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=ParentGraph}" StartElement="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=StartElement}" EndElement="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=EndElement}" StartPoint="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=StartPoint}" EndPoint="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=EndPoint}" />
                        <ItemsControl Background="{x:Null}" ItemsSource="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=RelevantComplexLayerElements}" KeyboardNavigation.IsTabStop="False">
                            <ItemsControl.ItemsPanel>
                                <ItemsPanelTemplate>
                                    <Grid />
                                </ItemsPanelTemplate>
                            </ItemsControl.ItemsPanel>
                            <ItemsControl.ItemTemplate>
                                <DataTemplate>
                                    <Grid>
                                        <local:LayerElementBorder GraphSegment="{Binding ElementName=graphSegment}" OpacityMask="{Binding VisualBrush}" Background="{Binding ElementName=graphSegment, Path=FilterColorBrush}" Height="{Binding Height}" Width="{Binding Width}" Margin="{Binding Margin}" HorizontalAlignment="Left" VerticalAlignment="Top" IsHitTestVisible="True" />
                                    </Grid>
                                </DataTemplate>
                            </ItemsControl.ItemTemplate>
                        </ItemsControl>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <DataTrigger Binding="{Binding RelevantComplexLayerElements.Count}" Value="0">
                            <Setter TargetName="grid" Property="Effect" Value="{x:Null}" />
                        </DataTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    <Style TargetType="{x:Type local:GraphSegment}">
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="Stroke" Value="Black" />
        <Setter Property="StrokeThickness" Value="1" />
        <Setter Property="StrokeStartLineCap" Value="Round" />
        <Setter Property="StrokeEndLineCap" Value="Round" />
        <Setter Property="KeyboardNavigation.IsTabStop" Value="False" />
        <Style.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
                <Setter Property="Stroke" Value="Black" />
                <Setter Property="StrokeThickness" Value="3" />
            </Trigger>
        </Style.Triggers>
    </Style>

</ResourceDictionary>
